<template>
	<view class="content">
		<view class="userinfo-box">
			<view class="userinfo-item flexbox flexbox-middle">
				<view class="label flexchild">姓名</view>
				<view class="value">{{info.name}}</view>
			</view>
			<view class="userinfo-item flexbox flexbox-middle">
				<view class="label flexchild">证件号码</view>
				<view class="value">{{info.idNo}}</view>
			</view>
			<view class="userinfo-item flexbox flexbox-middle">
				<view class="label flexchild">手机号码</view>
				<view class="value">{{info.phone}}</view>
			</view>
		</view>
		
		<view @click="goMycard" class="userinfo-box">
			<view class="userinfo-item flexbox flexbox-middle">
				<view class="label flexchild">网证（CTID)</view>
				<view class="value">查看</view>
				<image class="more-icon" src="/static/images/more_icon.png"></image>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				info: {}
			}
		},
		onLoad: function(e) {
			this.getInfo()
			let ctid = e.ctid || ''
			if (ctid) {
				uni.setStorageSync('ctid', ctid);
			}
		},
		methods: {
			getInfo() {
				this.$HTTP.post('/wechat/userinfo', {}, true).then((res) => {
					let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
					let curRoute = '/' + routes[routes.length - 1].route
					if (res.data.role == 'user') {
						uni.redirectTo({
							url: `/pages/openWz-step1/index`
						});
						return false
					}
					this.info = res.data
					//this.info.phone = uni.getStorageSync('phone');
					
					
				}).catch(err => {
					
				}) 
			},
			goMycard() {
				uni.navigateTo({
				    url: `/pages/wzcard/index`
				});
			}
		}


	}
</script>

<style lang="scss" scoped>
	.userinfo-box {
		background-color: #FFFFFF;
		margin-top: 32rpx;
		padding: 0 40rpx;
	}
	.userinfo-item {
		height: 74rpx;
		border-bottom:1rpx solid #E9E9E9 ;
		.label {
			font-size: 32rpx;
			color: #333333;
		}
		.value {
			color: #999999;
			font-size: 28rpx;
		}
		.more-icon {
			width: 36rpx;
			height: 36rpx;
			margin-left: 16rpx;
		}
	}
	.userinfo-item:last-of-type {
		border: none
	}
</style>
<style lang="scss">
	page{
		background-color: #f8f8f8;
	}
</style>